package com.itheima.mall.service.PmsService;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.mall.mapper.PmsMapper.PmsProductAttributeCategoryMapper;
import com.itheima.mall.service.pmsService.PmsProductAttributeCategoryApi;
import com.itheima.pojo.pms.PmsProductAttributeCategory;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class PmsProductAttributeCategoryImpl implements PmsProductAttributeCategoryApi {

    @Autowired
    private PmsProductAttributeCategoryMapper productAttributeCategoryMapper;

    @Override
    public void save(PmsProductAttributeCategory category) {
        productAttributeCategoryMapper.insert(category);
    }

    @Override
    public void removeById(Long id) {
        productAttributeCategoryMapper.deleteById(id);
    }


    @Override
    public PmsProductAttributeCategory updateByid(Long id, String name) {
        PmsProductAttributeCategory category=new PmsProductAttributeCategory();
        category.setName(name);
        category.setId(id);
         productAttributeCategoryMapper.updateById(category);
         return null;
    }

    @Override
    public PmsProductAttributeCategory getById(String id) {
        return productAttributeCategoryMapper.selectById(id);
    }

    @Override
    public Page<PmsProductAttributeCategory> page(Page<PmsProductAttributeCategory> pageInfo) {
        LambdaQueryWrapper<PmsProductAttributeCategory> wrapper=new LambdaQueryWrapper();
        Page<PmsProductAttributeCategory> page = productAttributeCategoryMapper.selectPage(pageInfo, wrapper);
        return page;
    }
}
